﻿using MediatR;
using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using S.RBAC.Read.Api.Application.Command.DepartTypeCommand;

namespace S.RBAC.Read.Api.Application.CommandHandlers.DepartTypeHandler
{
    public class DepartTypeGetAllCommandHandler : IRequestHandler<DepartTypeGetAllCommand, List<DepartType>>
    {
        protected readonly IDepartTypeRepository _departType;

        public DepartTypeGetAllCommandHandler(IDepartTypeRepository departType)
        {
            _departType = departType;
        }

        public async Task<List<DepartType>> Handle(DepartTypeGetAllCommand request, CancellationToken cancellationToken)
        {
            return await _departType.GetAllDepartType();
        }
    }
}
